package cn.kgc.service.impl;

import cn.kgc.entity.Emp;
import cn.kgc.mapper.EmpMapper;
import cn.kgc.service.EmpService;
import cn.kgc.vo.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
@Slf4j
public class EmpServiceImpl implements EmpService {
    @Resource
    private EmpMapper empMapper;

    @Override
    public List<Emp> getAllEmp(Integer pageNo, Integer pageSize) {
        return empMapper.getAllEmp(new Page(pageNo,pageSize));
    }

    @Override
    public Emp getEmpById(Integer id) {
        return empMapper.getEmpById(id);
    }

    @Override
    public void addEmp(Emp emp) {
        empMapper.addEmp(emp);
        log.debug("8===D - - - addEmp:"+emp);
    }

    @Override
    public void update(Emp emp) {
        empMapper.update(emp);
    }

    @Override
    public void deleteEmpById(Integer id) {
        empMapper.deleteEmpById(id);
    }

    @Override
    public Integer countEmpByName(String name) {
        return empMapper.countEmpByName(name);
    }

    @Override
    public Integer countEmp() {
        return empMapper.countEmp();
    }
}
